#include<iostream>
#include "myList.hpp"
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
using namespace std;
bool isf(char c1, char c2) {
    if ((c1 == '(' && c2 == ')') || (c1 == '[' && c2 == ']') || (c1 == '{' && c2 == '}')) {
        return true;
    }
    return false;
}
bool isValid(string s) {
    int n = s.size();
    if (n & 1) {
        return false;
    }
    stack<char> st;
    for (char c : s) {
        switch (c) {
        case '(':
        case '[':
        case '{':
            st.push(c);
            break;
        case ']':
        case '}':
        case ')':
            if (!st.empty() && isf(st.top(), c)) {
                st.pop();
            }
            else {
                st.push(c);
            }
            break;
        default:
            return false;
        }
    }
    return st.empty();
}
int main() {
    isValid("()");
}